﻿@model FOA.Web.Models.ChangePasswordViewModel
@{
    ViewBag.Title = "ChangePassword";
    Layout = "~/Views/Shared/_ContentLayout.cshtml";
}
@section HeadIncluder 
{
   <link href='@Url.Content("~/Content/public.css")' rel="stylesheet" />
    <link href='@Url.Content("~/Content/con_style.css")' rel="stylesheet" />
}
@using (Html.BeginForm("ChangePassword", "Account", FormMethod.Post, new { id = "frm" }))
{ 
    <div>
        <div class="dbox_d">
            <table width="100%" class="dbox_con" >
                <tr>
                    <td class="text_s">同户名：</td>
                    <td colspan="3">
                        <input id="UserName" class="validate[required]" name="UserName"  disabled="disabled" value="@ViewBag.UserName" type="text" />
                    </td>
                </tr>
               <tr>
                    <td class="text_s">旧密码：</td>
                    <td colspan="3">
                        <input id="oldpwd" class="validate[required]" name="OldPassword"  type="password" />
                    </td>
                </tr>
               <tr>
                    <td class="text_s">新密码：</td>
                    <td colspan="3">
                        <input id="newpwd" class="validate[required]]" name="NewPassword" type="password" />
                    </td>
                </tr>
                <tr>
                    <td class="text_s">再次确认密码：</td>
                    <td colspan="3">
                        <input id="ConfirmPwd" class="validate[required]" name="ConfirmPassword" type="password" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
   <div class="btn_d">
        <span class="btn_s btn_c1"><a href="javascript:void(0)" onclick="bnt_reset()" target="_blank">重置</a></span>
        <span class="btn_s btn_c1"><a  href="javascript:void(0)" id="subbtn"  target="_blank">确定</a></span>
        <span class="btn_s btn_c2"><a  href="javascript:void(0)" onclick="cancel()" target="_blank">取消</a></span>
    </div> 
   
    <script src=@Url.Content("/Scripts/jquery.form.js") type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#frm").validationEngine({ promptPosition: "topLeft" });
            $("#subbtn").click(function () {
                var flag = $('#frm').validationEngine('validate');
                if (!flag) return false;
                if ($("#newpwd").val() != $("#ConfirmPwd").val()) {
                    alert("俩次输入的密码不一致，请再次输入！");
                    return false;
                }
                if ($("#newpwd").val().length<6 ) {
                    alert("密码长度不能低于6位，请再次输入");
                    return false;
                }
                $("#frm").ajaxSubmit(function (data) {
                    alert(data);
                    if (data == "你的账号名称或密码错误")
                        return false;
                    window.top.refresh();
                    window.top.oDG.close();
                });
            });
        });

        function bnt_reset() {
            $("#frm")[0].reset();
        };
        function cancel() {
            window.top.oDG.close();
        };
    </script>
    
}
